<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri='http://java.sun.com/portlet' prefix='portlet'%>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<%@ page import="cn.com.chinasoa.course.subscribe.model.*"%>
<%@ page import="cn.com.chinasoa.course.subscribe.util.*"%>
<%@ page import="com.x4ee.soa.portal.framework.tools.*"%>
<%@ page import="cn.com.chinasoa.restkernel.core.RestServiceURL"%>
<%@ page import="com.x4ee.soa.portal.container.kernel.impl.RenderResponseImpl"%>
<%@ page import="com.x4ee.soa.portal.container.core.*"%>
<%@ page import="javax.persistence.*"%>

<%String contextPath = request.getContextPath();%>
<portlet:defineObjects />
<script language="JavaScript"  type="text/javascript" src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/javascript/prototype.js"></script>
<script language="JavaScript"  type="text/javascript" src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/javascript/subscribe.js"></script>
<%RestServiceURL rsu=REST.createRESTURL("getCourseInfo",renderResponse);%>

<form method='post' action='<portlet:actionURL><portlet:param name="frameworkUri" value="subscribeOrderCreateAction"/></portlet:actionURL>'>
<table>
	<tr>
		<td valign="top">
		<table>
		<%EntityManager em = EntityManagerHelper.getEntityManager();%>
		<tr><th colspan="2" align="left" style="font-size: 13">在线预订课程</th></tr>
		<tr><td>
			<table><tr>
				<td>学员姓名:&nbsp;<input name="studentName" type="text" size="10" class="textfield"/></td>
				<td>性别:&nbsp;<select name="studentSex"><option value="false">男</option><option value="true">女</option></select></td>
			</tr></table>
		</tr>
		<tr><td colspan="2"><table><tr><td align="left">电子邮件:</td><td><input name="studentEmail" type="text" size="20" class="textfield"/></td></tr></table></td></tr>
		<tr><td colspan="2"><table><tr><td align="left">工作单位:</td><td><input name="studentCompany" type="text" size="20" class="textfield"/></td></tr></table></td></tr>
		<tr><td colspan="2"><table><tr><td align="left">联系地址:</td><td><input name="studentAddress" type="text" size="20" class="textfield"/></td></tr></table></td></tr>
		<tr><td colspan="2"><table><tr><td align="left">联系电话:</td><td><input name="studentPhone" type="text" size="20" class="textfield"/></td></tr></table></td></tr>
		<tr><td colspan="2"><table><tr><td align="left">移动电话:</td><td><input name="mobilePhone" type="text" size="20" class="textfield"/></td></tr></table></td></tr>
		<tr><td colspan="2"><table><tr><td align="left">选择课程:</td><td>
		<select name="arrangedCourse" onclick=javascript:getCourseInfo('CourseInfo','<%=rsu.toString()%>') >
	<%Query q = em.createQuery("select ac from ArrangedCourse ac");
		List acList = q.getResultList();
		for(Iterator acIt = acList.iterator();acIt.hasNext();){
			Object acObj = acIt.next();
			if((acObj!=null)&&(acObj instanceof ArrangedCourse)){
				ArrangedCourse ac = (ArrangedCourse)acObj;%>
				<option value="<%=ac.getId()%>" title="<%=ac.getTrainingSubject().getSummary()%>">[<%=ac.getTrainingAddress().getCity()%>]-[<%=ac.getTrainingSubject().getCode()%>]-[<%=DataTypeUtil.renderCalender(ac.getStartDate())%>]</option>
		<%}}%></select></td></tr></table></td></tr>
		<tr><td colspan="2"><table><tr><td align="left">
		<input type="image" src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/image/order.jpg" name="Submit" value="预订">
		<a href="<portlet:renderURL><portlet:param name="frameworkUri" value="SubscribeOrderQuery"/></portlet:renderURL>"><img border="0" src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/image/query.jpg"/></a></td><td><td></tr></table><td></tr>
		<%EntityManagerHelper.closeEntityManager();%>		
		</table>
		</td>
		<td valign="top">
			<div id="CourseInfo">

			</div>
		</td>
	</tr>
	<tr>
		<td>
			<table>
				<tr><th colspan="2" align="left" style="font-size: 13">网上报名流程</th></tr>
				<tr><td colspan="2"><table><tr><td align="left">(1) 选择课程,同时选取可享受的优惠策略</td></tr></table></td></tr>
				<tr><td colspan="2"><table><tr><td align="left">(2) 提交后,下载报名回执</td></tr></table></td></tr>
				<tr><td colspan="2"><table><tr><td align="left">(3) 根据报名回执,安排付款</td></tr></table></td></tr>
				<tr><td colspan="2"><table><tr><td align="left">(4) 付款后，查询课程订单状态,如期上课</td></tr></table></td></tr>					
			</table>
		</td>
	</tr>
</table>
</form>
		

